package com.culturalCenter.dataCenter.service.impl.user;

import com.culturalCenter.dataCenter.entity.user.Picture;
import com.culturalCenter.dataCenter.mapper.user.PictureMapper;
import com.culturalCenter.dataCenter.service.user.PictureService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author:
 * @Description:Picture业务层接口实现类
 * @Date
 *****/
@Service
public class PictureServiceImpl implements PictureService {

    @Resource
    private PictureMapper pictureMapper;

    @Override
    public PageInfo<Picture> findPage(int page, int size) {
        return PageHelper.startPage(page, size).doSelectPageInfo(() -> pictureMapper.findPageAll());
    }

    @Override
    public Integer delete(String id) {
        return pictureMapper.deleteById(id);
    }

    @Override
    public Integer update(Picture picture) {
        return pictureMapper.update(picture);
    }

    @Override
    public Integer add(Picture picture) {
        return pictureMapper.insert(picture);
    }

    @Override
    public Picture findById(String id) {
        return pictureMapper.queryById(id);
    }

    @Override
    public List<Picture> findAll(Picture picture) {
        return (List<Picture>) pictureMapper.queryAll(picture);
    }

}
